package com.tencent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tencent.entity.Member;
import com.tencent.entity.Pagination;
import com.tencent.mapper.MemberMapper;
import com.tencent.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author King
 * @Date 2022/8/12 16:21
 * @Version 1.0.0
 */
@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberMapper memberMapper;

//    @Override
//    public List<Member> findAll() {
//        return null;
//    }

    @Override
    public PageInfo<Member> findByName(Pagination pagination) {
        //设置分页参数
        PageHelper.startPage(pagination.getCurrentPage(),pagination.getPageSize());
        //查询
        List<Member> allName = memberMapper.findAllName(pagination.getQueryString());
        return new PageInfo<>(allName);
    }
}
